// test.js
var chart = require("../../utils/chart.js");
Page({

  data: {
  },
  onLoad: function (options) {
    console.log('载入');
    chart.draw(this, 'canvas1', {
      title: {
        text: "观众观看时长分布（单位：人/min）",
        color: "#333333"
      },
      xAxis: {
        data: ['0-10', '10-20', '20-30', '30-40', '40-50', '50-60', '60-70', '>70']
      },
      series: [
        {
          name: "第一季度",
          category: "bar",
          data: [2337, 1163, 560, 178, 92, 63, 57, 48]
        },
  
      ]
    });
    console.log('this='+this)
    chart.draw(this, 'canvas2', {
      title: {
        text: "观众人数变化曲线（单位：人/min）",
        color: "#333333"
      },
      xAxis: {
        data: ['10', '20', '30', '40', '50', '60', '70', '80']
      },
      series: [
       
        {
          name: "直播序号：1",
          category: "line",
          data: [579,1235, 1438, 3000, 1148, 927, 643, 1435]
        },
        
      ]
    });
    chart.draw(this, 'canvas3', {
      title: {
        text: "弹幕数量曲线（单位：条/min）",
        color: "#333333"
      },
      xAxis: {
        data: ['10', '20', '30', '40', '50', '60', '70', '80']
      },
      series: [
       
        {
          name: "直播序号：1",
          category: "line",
          data: [379,735, 1738, 5800, 3248, 1527, 1443, 1935]
        },
        
      ]
    });
    
    chart.draw(this, 'canvas4', {
      title: {
        text: "直播商品下单量（单位：件）",
        color: "#333333"
      },
      xAxis: {
        data: ['纪梵希', 'GUCCI', 'DIOR', 'COACH', 'MAC', '其他'],
      },
      series: [

        {
          name: ['纪梵希', 'GUCCI', 'DIOR', 'COACH', 'MAC', '其他'],
          category: "pie",
          data: [140, 138, 29, 28, 7, 53]
        }
      ]
    });
    chart.draw(this, 'canvas5', {
      title: {
        text: "下单时间分布（单位：件/min）",
        color: "#333333"
      },
      xAxis: {
        data: ['10', '20', '30', '40', '50', '60', '70', '80']
      },
      series: [
       
        {
          name: "直播序号：1",
          category: "line",
          data: [79,35, 238, 500, 748, 327, 543, 415]
        },
        
      ]
    });
  },
  onSaveClick: function () {
    chart.saveCanvans(function () {

    });
  }
})